package com.sindvision.cces.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sindvision.cces.beans.User;
import com.sindvision.cces.dao.UserDAO;
import com.sindvision.cces.service.IUserSV;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: chenjintao
 * @Date: 2019-11-22 16:44
 */
@Service
public class UserSVImpl extends ServiceImpl<UserDAO, User> implements IUserSV {

    @Override
    public User getUserByUserName(String username) {
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("username", username);
        List<User> userList = baseMapper.selectList(wrapper);
        if (userList == null || userList.isEmpty()) return null;
        return userList.get(0);
    }
}
